import React, { Component } from 'react';
import {Route,Switch,Redirect,withRouter} from 'react-router-dom'
import Nav1Text1 from '../../../layout/content/example/context';
import Nav1Text2 from '../../../layout/content/example/todo';
import Nav2Text1 from '../../../layout/content/example/dispatch1';

import NoMatch from '../../error/404'

import Bundle from './bundle'
const Chat = (props) => (
    <Bundle load={() => import('../../../layout/content/nav2/option2')}>
        {(Chat) => <Chat {...props}/>}
    </Bundle>
);

class Content extends Component {
    state={
      url:null
    };
    authRequired = ()=> {
        //const com = 0 ? (<Redirect to="/login"/>) : (<Nav1Text1 />);
        //return com;
    };
    render() {
        return (
            <div className="main-content">
                <Switch>
                    <Route path="/app/nav1/first" component={Nav1Text1}/>
                    <Route path="/app/nav1/second" component={Nav1Text2}/>
                    <Route path="/app/nav2/option1" component={Nav2Text1}/>
                    <Route path="/app/nav2/option2" component={Chat}/>
                    <Route path="/app/404" component={NoMatch}/>
                    <Route render={()=><Redirect to="/app/nav1/first"/>}/>
                </Switch>
            </div>
        );
    }
}

export default withRouter(Content);
